import 'package:demo/app/widgets/line_horizontal.dart';
import 'package:demo/theme/app_colors.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../../../../theme/app_text_theme.dart';
import 'tab1_controller.dart';
import 'package:flutter/material.dart';

import 'package:get/get.dart';


class Tab1View extends GetView<Tab1Controller> {
  const Tab1View({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
          margin: EdgeInsets.symmetric(horizontal: 15.w),
          padding: EdgeInsets.symmetric(horizontal: 15.w),
          decoration: BoxDecoration(
              color: Color_white,
              borderRadius: BorderRadius.all(Radius.circular(8.w))
          ),
          child: Column(
            children: [
              /// 学历
              InkWell(
                onTap: () => controller.chooseEducation(),
                child: SizedBox(
                  height: 40.w,
                  child: Row(children: [
                    Text('学历' ,style: text_131732_14),
                    SizedBox(width: 6.w),
                    Expanded(child: Obx(()=>Text(controller.selectEducation.value.value,style: text_131732_14,maxLines: 1, overflow: TextOverflow.ellipsis,textAlign:TextAlign.right))),
                    Image.asset('assets/images/ic_next.png',width: 15.w,height: 15.w),
                  ]),
                ),
              ),
              const LineHorizontal(),
              /// 婚姻情况
              InkWell(
                onTap: () => controller.chooseMarital(),
                child: SizedBox(
                  height: 40.w,
                  child: Row(children: [
                    Text('婚姻情况' ,style: text_131732_14),
                    SizedBox(width: 6.w),
                    Expanded(child: Obx(()=>Text(controller.selectMarriage.value.value,style: text_131732_14,maxLines: 1, overflow: TextOverflow.ellipsis,textAlign:TextAlign.right))),
                    Image.asset('assets/images/ic_next.png',width: 15.w,height: 15.w),
                  ]),
                ),
              ),
              const LineHorizontal(),
              /// 居住城市
              InkWell(
                onTap: () => controller.chooseProvince(),
                child: SizedBox(
                  height: 40.w,
                  child: Row(children: [
                    Text('居住城市' ,style: text_131732_14),
                    SizedBox(width: 6.w),
                    Expanded(child: Obx(()=>Text(controller.selectArea.value.value,style: text_131732_14,maxLines: 1, overflow: TextOverflow.ellipsis,textAlign:TextAlign.right))),
                    Image.asset('assets/images/ic_next.png',width: 15.w,height: 15.w),
                  ]),
                ),
              ),
              const LineHorizontal(),
              /// 详细地址
              SizedBox(
                height: 40.w,
                child: Row(children: [
                  Text('详细地址' ,style: text_131732_14),
                  SizedBox(width: 6.w),
                  Expanded(
                    child: KeyboardListener(
                      focusNode: controller.focusNode,
                      child: TextField(
                        controller: controller.addressController,
                        textAlign: TextAlign.right,
                        style: text_131732_14,
                        maxLines: 1,
                        decoration: InputDecoration(
                          prefixText: "  ",
                          isDense: true,
                          contentPadding: EdgeInsets.symmetric(vertical: 9.w),
                          counterText: "", // 去掉底部计数
                          enabledBorder:  const UnderlineInputBorder(borderSide: BorderSide.none), //无焦点时状态
                          focusedBorder:  const UnderlineInputBorder(borderSide: BorderSide.none), //有焦点时状态
                          hintText: '请输入详细地址',
                          hintStyle: text_grey_14,
                        ),
                      ),
                    ),
                  ),
                ]),
              ),
              const LineHorizontal(),
              /// 住房类型
              InkWell(
                onTap: () => controller.chooseLiveHouse(),
                child: SizedBox(
                  height: 40.w,
                  child: Row(children: [
                    Expanded(child: Text('住房类型' ,style: text_131732_14)),
                    SizedBox(width: 6.w),
                    Expanded(child: Obx(()=>Text(controller.selectLiveHouse.value.value,style: text_131732_14,maxLines: 1, overflow: TextOverflow.ellipsis,textAlign:TextAlign.right))),
                    Image.asset('assets/images/ic_next.png',width: 15.w,height: 15.w),
                  ]),
                ),
              ),
              const LineHorizontal(),
              /// 车来信息
              InkWell(
                onTap: () => controller.chooseCar(),
                child: SizedBox(
                  height: 40.w,
                  child: Row(children: [
                    Expanded(child: Text('车辆信息' ,style: text_131732_14)),
                    SizedBox(width: 6.w),
                    Expanded(child: Obx(()=>Text(controller.selectCar.value.value,style: text_131732_14,maxLines: 1, overflow: TextOverflow.ellipsis,textAlign:TextAlign.right))),
                    Image.asset('assets/images/ic_next.png',width: 15.w,height: 15.w),
                  ]),
                ),
              ),
              const LineHorizontal(),
              /// 社保缴纳
              InkWell(
                onTap: () => controller.chooseSocial(),
                child: SizedBox(
                  height: 40.w,
                  child: Row(children: [
                    Expanded(child: Text('社保缴纳' ,style: text_131732_14)),
                    SizedBox(width: 6.w),
                    Expanded(child: Obx(()=>Text(controller.selectSocial.value.value,style: text_131732_14,maxLines: 1, overflow: TextOverflow.ellipsis,textAlign:TextAlign.right))),
                    Image.asset('assets/images/ic_next.png',width: 15.w,height: 15.w),
                  ]),
                ),
              ),
              const LineHorizontal(),
              /// 保单信息
              InkWell(
                onTap: () => controller.chooseInsurance(),
                child: SizedBox(
                  height: 40.w,
                  child: Row(children: [
                    Expanded(child: Text('保单信息' ,style: text_131732_14)),
                    SizedBox(width: 6.w),
                    Expanded(child: Obx(()=>Text(controller.selectInsurance.value.value,style: text_131732_14,maxLines: 1, overflow: TextOverflow.ellipsis,textAlign:TextAlign.right))),
                    Image.asset('assets/images/ic_next.png',width: 15.w,height: 15.w),
                  ]),
                ),
              ),
              const LineHorizontal(),
              /// 芝麻分
              InkWell(
                onTap: () => controller.chooseZmScore(),
                child: SizedBox(
                  height: 40.w,
                  child: Row(children: [
                    Expanded(child: Text('芝麻分' ,style: text_131732_14)),
                    SizedBox(width: 6.w),
                    Expanded(child: Obx(()=>Text(controller.selectZmScore.value.value,style: text_131732_14,maxLines: 1, overflow: TextOverflow.ellipsis,textAlign:TextAlign.right))),
                    Image.asset('assets/images/ic_next.png',width: 15.w,height: 15.w),
                  ]),
                ),
              ),
              const LineHorizontal(),
              /// 公积金
              InkWell(
                onTap: () => controller.chooseAccumulation(),
                child: SizedBox(
                  height: 40.w,
                  child: Row(children: [
                    Expanded(child: Text('公积金' ,style: text_131732_14)),
                    SizedBox(width: 6.w),
                    Expanded(child: Obx(()=>Text(controller.selectAccumulation.value.value,style: text_131732_14,maxLines: 1, overflow: TextOverflow.ellipsis,textAlign:TextAlign.right))),
                    Image.asset('assets/images/ic_next.png',width: 15.w,height: 15.w),
                  ]),
                ),
              ),
              const LineHorizontal(),
              /// 邮箱
              SizedBox(
                height: 40.w,
                child: Row(children: [
                  Text('邮箱' ,style: text_131732_14),
                  SizedBox(width: 6.w),
                  Expanded(
                    child: KeyboardListener(
                      focusNode: controller.focusNode,
                      child: TextField(
                        controller: controller.emailController,
                        textAlign: TextAlign.right,
                        style: text_131732_14,
                        decoration: InputDecoration(
                          prefixText: "  ",
                          isDense: true,
                          contentPadding: EdgeInsets.symmetric(vertical: 12.w),
                          counterText: "", // 去掉底部计数
                          enabledBorder:  const UnderlineInputBorder(borderSide: BorderSide.none), //无焦点时状态
                          focusedBorder:  const UnderlineInputBorder(borderSide: BorderSide.none), //有焦点时状态
                          hintText: '请输入邮箱',
                          hintStyle: text_grey_14,
                        ),
                      ),
                    ),
                  ),
                ]),
              ),
            ],
          ),
        ),
        SizedBox(height: 30.w),
        RawMaterialButton(
          fillColor: Color_main,
          elevation:0,
          highlightElevation:0,
          shape : RoundedRectangleBorder(borderRadius : BorderRadius.all(Radius.circular(22.w))),
          constraints: BoxConstraints.tightFor(width: Get.width - 60.w, height:44.w),
          child: Text('下一步',style: text_white_16b),
          onPressed: ()=> controller.submit(),
        ),
        SizedBox(height: 30.w),
      ],
    );
  }
}
